#include <stdio.h>

int main()
{
int a,b ;
int a11,a12,a13,a21,a22,a23,a31,a32,a33;
printf("type the 2 or 3 to choose the 2x2 or 3x3matrix\n");
scanf("%d",&a);
if (a==2)
{
    printf ("type the a11 a12 a21 a22\n");
    scanf("%d,%d,%d,%d",&a11,&a12,&a21,&a22);
    b=det2(a11,a12,a21,a22);
    printf("%d\n",&b);
}
else
{
    printf("type the a11 to a33\n");
    scanf("%d %d %d %d %d %d %d %d %d",&a11,&a12,&a13,&a21,&a22,&a23,&a31,&a32,&a33);
    det3(a11,a12,a13,a21,a22,a23,a31,a32,a33);
}
return 0;
}
det2 (int a ,int b ,int c ,int d)
{
    return ((a*c)-(b*d));
}

det3(int a , int b,int c ,int d ,int e ,int f ,int g,int h,int i )
{
int A;
A=a*det2(e,f,h,i)+b*det2(d,f,g,i)+c*det2(d,e,g,h);
printf("%d\n",A);
return (A);
}
